package com.ruoyi.project.good.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.good.mapper.GoodSpecMapper;
import com.ruoyi.project.good.domain.GoodSpec;
import com.ruoyi.project.good.service.IGoodSpecService;

/**
 * 商品规格Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-01
 */
@Service
public class GoodSpecServiceImpl implements IGoodSpecService 
{
    @Autowired
    private GoodSpecMapper goodSpecMapper;

    /**
     * 查询商品规格
     * 
     * @param specId 商品规格ID
     * @return 商品规格
     */
    @Override
    public GoodSpec selectGoodSpecById(Long specId)
    {
        return goodSpecMapper.selectGoodSpecById(specId);
    }

    @Override
    public List<GoodSpec> selectGoodSpecListByGoodId(Long goodId) {
        return goodSpecMapper.selectGoodSpecListByGoodId(goodId);
    }

    /**
     * 查询商品规格列表
     * 
     * @param goodSpec 商品规格
     * @return 商品规格
     */
    @Override
    public List<GoodSpec> selectGoodSpecList(GoodSpec goodSpec)
    {
        return goodSpecMapper.selectGoodSpecList(goodSpec);
    }

    /**
     * 新增商品规格
     * 
     * @param goodSpec 商品规格
     * @return 结果
     */
    @Override
    public int insertGoodSpec(GoodSpec goodSpec)
    {
        goodSpec.setCreateTime(DateUtils.getNowDate());
        return goodSpecMapper.insertGoodSpec(goodSpec);
    }

    /**
     * 修改商品规格
     * 
     * @param goodSpec 商品规格
     * @return 结果
     */
    @Override
    public int updateGoodSpec(GoodSpec goodSpec)
    {
        return goodSpecMapper.updateGoodSpec(goodSpec);
    }

    /**
     * 批量删除商品规格
     * 
     * @param specIds 需要删除的商品规格ID
     * @return 结果
     */
    @Override
    public int deleteGoodSpecByIds(Long[] specIds)
    {
        return goodSpecMapper.deleteGoodSpecByIds(specIds);
    }

    /**
     * 删除商品规格信息
     * 
     * @param specId 商品规格ID
     * @return 结果
     */
    @Override
    public int deleteGoodSpecById(Long specId)
    {
        return goodSpecMapper.deleteGoodSpecById(specId);
    }

    @Override
    public int deleteGoodSpecByGoodsId(Long goodsId) {
        return goodSpecMapper.deleteGoodSpecByGoodsId(goodsId);
    }
}
